﻿from wsgiref.simple_server import make_server
import query_string
#from flask import request
    
    
    
    
def run(environ, start_response):
    #for k,v in environ.items():
    #    print(k,':',v)
    status = '200 OK'
    output = ['<h3>Hello, world!112</h3>'.encode('utf-8')]
    
    #name = request.args.get('name')
    #pwd = request.args.get('pwd')
    
    #name = '1111'
    #pwd = '2222'
    
    get_str = query_string.parse(environ.get('QUERY_STRING'))
    name = get_str.get('name','')
    pwd = get_str.get('pwd','')
    
    
    output = ['<h1>用户登录的信息</h1><h1>用户名：{}</h1><h1>口令：{}</h1>'.format(name,pwd).encode('utf-8'),'添加添加添加添加~~~'.encode('utf-8')]
    response_headers = [('Content-type', 'text/html;charset=utf-8')]
    start_response(status, response_headers)
    return output

httpd = make_server('', 8000, run)
print("Serving on port 8000...")
httpd.serve_forever()

